From: Matthew Daley Date: Sun, 1 Dec 2013 10:14:55 +0000 (+1300) Subject: libxl: fix unsigned less-than-0 comparison in e820_sanitize X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5759 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5d71457def05299bfa69276bb7f31db705f05f19;p=xen.git libxl: fix unsigned less-than-0 comparison in e820_sanitize Both src[i].size and delta are unsigned, so checking their difference for being less than 0 doesn't work. Coverity-ID: 1055615 Signed-off-by: Matthew Daley Acked-by: Ian Jackson --- diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index e1c183fe73..b11d0364df 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -125,7 +125,7 @@ static int e820_sanitize(libxl_ctx *ctx, struct e820entry src[], src[i].type = E820_UNUSABLE; delta = ram_end - src[i].addr; /* The end < ram_end should weed this out */ - if (src[i].size - delta < 0) + if (src[i].size < delta) src[i].type = 0; else { src[i].size -= delta;